<?php
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// admin/acat_$global.php Page have the html Of the adding Categories                                                                *\
// Powered by Shumool Information Technology                                                                                     *\
// Contact Data                                                                                                                  *\
// WEb site : http://www.shumool.com                                                                                             *\ 
// E-mail : info@shumool.com                                                                                                     *\
// Ver 1.00 Demo started at 5/4/2009                                                                                             *\
// Please Don't Remove This Copy rights                                                                                          *\
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
session_start();
include ("../sys/shumool.php");
$redirect="index.php";
dosession($redirect);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>EGYPT CTMC NONWOVENS CO</title>
<link href="css/dgstyle.css" rel="stylesheet" type="text/css" />
<link href="css/shumool.css" rel="stylesheet" type="text/css">
<script language="javascript">
function addgmcheck()
{
if (addgm.name.value=="")
{
alert(" Please enter name ");
document.addgm.name.focus();
return false;
}
}
</script> 
<style type="text/css">
<!--
.style1 {color: #FF0000}
-->
</style>
</head>
<body>
<br />
<?php
if (isset($_POST['Submit']))
{
addsub_$global($globalpost);
echo "<script>alert(' The operation took place successfully ');</script>";
echo "<meta http-equiv='Refresh' content='0;url=vcat_$global.php'>";

}else{
if (isset($_GET['doo'])=='ed' and isset($_GET['ids']))
{
$fields="*";
$tbl = 'sub_$global';
$where = ' id=' . $_GET['ids'];
$ordered = ' id';
$arrange = ' desc';
$limit = ' 1';
$a=selectdb($fields,$tbl,$where,$ordered, $arrange);
$b=mysql_fetch_array($a[0]);
}
?>
<table width="80%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" class="dgTotRowsTR">
 <form action="" method="post" name="addgm" onsubmit="return addgmcheck();" enctype="multipart/form-data"> <tr>
    <td colspan="2" align="center"><?php if (!isset($doo)){?>Add New Content<?php }else if (isset($_GET['doo'])=='ed'){?>
      Edit Content      <?php } ?></td>
  </tr>
  <tr>
    <td width="19%" align="left" style="padding-right:30px;">* Title</td>
    <td width="81%" align="left">&nbsp;<input name="title" type="text" class="dgRowsTot" size="30" value="<?php echo @$b['title'];?>" /></td>
      </tr>
    <tr>
    <td width="19%" align="left" style="padding-right:30px;">* Pic</td>
    <td width="81%" align="left">
	<input type="hidden" name="MAX_FILE_SIZE" value="8000000" >
	<input name="photo" type="file" class="texts" id="data" dir="ltr">
    <?php if (isset($doo)){$imagenew="../" . $b['image'];
	if (file_exists($imagenew)){?><a href="<?php echo @$imagenew?>" target="_blank"><img src="<?php echo @$imagenew;?>" width="50" height="50" border="0" /></a><?php } } ?>	
		  <br>
	  <span class="style1">** You Must Upload Images Only Which Has jpg & png Extinsions.</span></td>
  </tr>
  
    <tr>
    <td width="19%" align="left" style="padding-right:30px;">* Attache File</td>
    <td width="81%" align="left">
	<input type="hidden" name="MAX_FILE_SIZE" value="8000000" >
	<input name="attache" type="file" class="texts" id="data" dir="ltr">
    <?php if (isset($doo)){$attache="../" . $b['attache'];
	if (file_exists($attache)){?><a href="<?php echo @$attache;?>" target="_blank"><img src="images/ed_link.gif" width="18" height="18" border="0" /></a><?php } } ?>	
		  <br>
	  <span class="style1">** You Must Upload Files Only Which Has Media Extinsions.</span></td>
  </tr>
  
     <tr>
     <td width="19%" align="left" style="padding-right:30px;">* Department</td>
    <td width="81%" align="left"><select name="catid" id="catid" dir="ltr">
	<?php if (isset($_GET['doo'])=='ed')
	{
	$fields="*";
	$tbl="cat_$global";
	$where = "id='" . $b['catid'] . "'";
	$ordered=" id ";
	$arrange=" desc";
	$limit="1";
	$selectcat=selectdb($fields,$tbl,$where,$ordered, $arrange, $limit);
	$rowcat=mysql_fetch_array($selectcat[0]);
?>
<option value="<?php echo @$rowcat['0'];?>" selected="selected"><?php echo @$rowcat['name'];?></option>
<?php } ?>
	<?php $fields="*";
	$tbl="cat_$global";
	if (isset($_GET['doo'])=='ed')
	{
		$where = "id <>'".$b['catid']."'";
	} else {
		$where = "1";
	}
	$ordered=" id ";
	$arrange=" desc";
	$limit="100000";
	$selectcat=selectdb($fields,$tbl,$where,$ordered, $arrange, $limit);
while ($rowcat=mysql_fetch_array($selectcat[0])){ ?>
<option value="<?php echo @$rowcat['id'];?>"><?php echo @$rowcat['name'];?></option>
<?php } ?></select>	</td>
  </tr>
     <tr>
    <td width="19%" align="left" >* Details</td>
    <td width="81%" align="left"><?php @$content=$b['content']; include ("content.php");?></td>
  </tr>
 
    <tr>
    <td width="19%" align="left" >* Published </td>
    <td width="81%" align="left"><input type="checkbox" class="dgRowsTot" name="cshow" <?php if(isset($b['cshow'])){?> checked="checked"<?php }?> value="1"  /></td>
  </tr>
   <tr>
    <td colspan="2" align="center"><?php if (isset($b)){?>
      <input type='hidden' name='doo' value='ed'>
	<input type='hidden' name='ids' value='<?php echo @$_GET['ids']?>'><?php } ?>
	<?php if (isset($_GET['doo'])=='ed')
{
?>	
	
<input type="button" value="Show All" class="dgAjax" onclick="javascript:location.href('vsub_$global.php?catid=<?php echo @$b['catid'];?>');" />
	<?php } ?>	<input type="submit" name="Submit" value="<?php if (isset($b)){?>Edit<?php }else{ ?>Add<?php } ?>" class="dgAjax" style="width:75px;" /></td>
    </tr>
 </form>
</table>
<?php } ?>
</body>
</html>
